package com.huluobo.a2204monthparkdemo.parking

import android.content.Intent
import android.graphics.BitmapFactory
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.google.vr.sdk.widgets.pano.VrPanoramaView
import com.huluobo.a2204monthparkdemo.R
import com.huluobo.a2204monthparkdemo.databinding.ActivityParkingVractivityBinding
import com.huluobo.base.bean.ParkingBeanItem
import com.huluobo.base.mvvm.BaseActivity
import com.huluobo.base.net.Const
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class ParkingVRActivity : BaseActivity<ActivityParkingVractivityBinding, ParkingViewModel>() {
    private lateinit var parkBeanItem: ParkingBeanItem
    override fun initData() {
        parkBeanItem = intent.getSerializableExtra(Const.URL_PARKING) as ParkingBeanItem
    }

    override fun initView() {
        binding.vrHeader.headerTitle.text = "车位预览"
        binding.vrHeader.headerBack.setOnClickListener { finish() }
        binding.vrHeader.headerAdd.visibility = View.VISIBLE
        binding.vrHeader.headerAdd.setOnClickListener {
            val intent = Intent(this, ParkingValueActivity::class.java)
            intent.putExtra(Const.URL_PARKING, parkBeanItem)
            startActivity(intent)
        }

        val option = VrPanoramaView.Options()
        option.inputType = VrPanoramaView.Options.TYPE_MONO
        binding.vrView.loadImageFromBitmap(BitmapFactory.decodeResource(resources, R.drawable.ddd), option)
    }
}